﻿using System.Windows;

namespace 命令模式
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();
            //正常调用
            //var document=new Document();
            //document.Display();
            //document.Redo();
            //document.Undo();
            //
            //命令模式
            var document = new Document();
            DocumentCommand discmd = new DisplayCommand(document);
            DocumentCommand undcmd =new UndoCommand(document);
            DocumentCommand redcmd=new RedoCommand(document);
            var invoker=new DocumentInvoker(discmd,undcmd,redcmd);
            invoker.Display();
            invoker.Redo();
            invoker.Undo();

        }
    }
}
